package dyyx.playrpc;

import java.net.InetSocketAddress;

public class RpcTest {

	public static void main(String[] args) throws Exception {

		final int port = 8083;
		System.out.println("port="+port);

		new Thread(new Runnable() {
			public void run() {
				try {
					RpcExporter.exporter("localhost", port);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		}).start();

		RpcImporter<HelloService> importer = new RpcImporter<HelloService>();
		HelloService hello = importer.importer(HelloServiceImpl.class, new InetSocketAddress("localhost", port));
		
		System.out.println(hello.sayHello("tiger"));
		System.out.println(hello.sayHello("cat"));
	}
}
